/*
 * CCamera.h
 *
 *  Created on: Sep 19, 2011
 *      Author: welcome
 */

#ifndef CCAMERA_H_
#define CCAMERA_H_

#include <GLES/gl.h>
#include <KD/kd.h>
#include <system/math.h>

namespace GGEngine {

class CCamera {
public:
	CCamera();

	virtual ~CCamera();

    void setEyePosition(GLfloat x, GLfloat y, GLfloat z);

    void setCenter(GLfloat center_x, GLfloat center_y, GLfloat center_z);

    void setUp(GLfloat up_x, GLfloat up_y, GLfloat up_z);

    void lookAt();

private:
	GLfloat m_x;
	GLfloat m_y;
	GLfloat m_z;

    GLfloat m_center_x;
    GLfloat m_center_y;
    GLfloat m_center_z;

    GLfloat m_up_x;
    GLfloat m_up_y;
    GLfloat m_up_z;

    void crossProduct(float v0[3], float v1[3], float r[3]);

    void normalize(float v[3]);

    void identity(GLfloat m[]);
};

} /* namespace GGEngine */
#endif /* CCAMERA_H_ */

